/**********************************************************************************************************************/
* 
*   "Civil War and Citizens' Demand for the State: An Empirical Test of Hobbesian Theory"
*	Replication Files
*   Robert A. Blair
*
***********************************************************************************************************************/



					clear
					set more off, permanently



					gl replication "[YOUR DIRECTORY HERE]"		




*********
* SETUP *
*********

					use "$replication/data/leaders_data.dta", clear
	
					svyset [pweight=pweight], psu(commcode) strata(county)			
																						
					gl I_CONTROLS r2_l_age_imputed r2_l_male  r2_l_born_town r2_l_tribe_fe* r2_l_prewar_unemployed r2_l_prewar_land_any

					gl C_CONTROLS ofhouses school_yes health_yes wdaccessinwet_yes
																
					gl DISTRICTS district_fe*
					
					gl COMMUNITIES community_fe*
					

	
						
		

			
************
* ANALYSIS *
************				
			
			
			
	*** Table 5
						
					local title "table5"
					
					cap erase "$replication/output/`title'.xls"
					cap erase "$replication/output/`title'.txt"

					foreach y of varlist r2_l_casepoli_dum r2_l_casepchf_dum {
						local lab : var label `y'
						svy: reg `y' acled_num_wartime $I_CONTROLS $DISTRICTS
						outreg2 using "$replication/output/`title'.xls", ///
							append excel lab ctitle(`lab') aster(se) dec(3) br nocons keep(acled_num_wartime)
						}
					foreach y of varlist r2_l_casepoli_dum r2_l_casepchf_dum {
						local lab : var label `y'
						svy: reg `y' acled_any_wartime $I_CONTROLS $DISTRICTS
						outreg2 using "$replication/output/`title'.xls", ///
							append excel lab ctitle(`lab') aster(se) dec(3) br nocons keep(acled_any_wartime)
						}
					foreach y of varlist r2_l_casepoli_dum r2_l_casepchf_dum {
						local lab : var label `y'
						svy: reg `y' acled_any_wartime_d_i10 $I_CONTROLS $DISTRICTS
						outreg2 using "$replication/output/`title'.xls", ///
							append excel lab ctitle(`lab') aster(se) dec(3) br nocons keep(acled_any_wartime_d_i10)
						}
		
		

						
